package com.lanyou.esb.cook.proxy.meta;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

import com.lanyou.esb.cook.proxy.common.SystemResCode;

/**
 * 接口类型<br>
 * 描述：<br>
 * 1:Web Service SOAP类型；2：restfull类型；3：ftp类型
 * 
 * @author Davey.wu
 */
public enum IfType {

	WS("1"), REST("2"), FTP("3");

	// public static final String TypeCode = "10009";

	public final String ValueCode;

	private IfType(String code) {
		this.ValueCode = code;
	}

	public static IfType get(String valueCode) throws NoSuchObjectException {
		if (StringUtils.isBlank(valueCode)) {
			throw new NullPointerException();
		}
		for (IfType type : IfType.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(SystemResCode.MSG_UNKNOW_INTERFACE_TYPE
				+ "(InterfaceType=" + valueCode + ")");
	}
}
